<?php
function imageResize($width, $height, $target) {



if ($width > $height) {
$percentage = ($target / $width);
}
else {

$percentage = ($target / $height);
}

$width = round($width * $percentage);
$height = round($height * $percentage);


return "width=\"$width\" height=\"$height\"";
//End of function
}


?>








<!--Here starts the use of the function-->

<?php
$image = getimagesize("../Bildgalleri/Paintings/1303292919-ren.jpg");
$newSize = imageResize($image[0],$image[1],200);
?>
<!--using a standard html image tag, where you would have the
width and height, insert your new imageResize() function with
the correct attributes-->


<img alt="Img not found"  src="../Bildgalleri/Paintings/1303292919-ren.jpg" <?php echo $newSize;?>/>




